//防抖
function debounce(func, time) {
  let timeout = null;
  return function () {
    clearTimeout(timeout);
    timeout = setTimeout(func, time);
  };
}
//节流
function throttle(func, time) {
  let isbool;
  return function () {
    if (!isbool) {
      func();
      isbool = ture;
      setTimeout(() => {
        isbool = false;
      }, time);
    }
  };
}
//递归
function countDown(num) {
  console.log(num);
  num--;
  if (num == 0) {
    return 0;
  }
  countDown(num);
  return 0;
}
//数组操作
function flattenArray(arr) {
  let rr = [];
  function Array(arr) {
    let i = 0;
    for (let i = 0; i < arr.length; i++) {
      if (typeof arr[i] == "number") {
        rr.push(arr[i]);
      } else {
        Array(arr[i]);
      }
    }
    return;
  }
  Array(arr);
  return rr;
}
